# coding:utf-8
str1 = "I love fishc.com"
# print (str1[:6])

str1 = 'FishC'
# print (str1.casefold())

str1 = "AbcABCabCabcABCabc"
# print (str1.count('ab',0,15))

str1 = "I love fishc.com"
# print (str1.find("fishc"))
# print (str1.find("good"))
# print (str1.index("fishc"))
# print (str1.index("good"))

# print ('x'.join("Test"))
# print('_'.join("FishC"))
# 注：用join()来连接字符串，用（+）会引起内存复制以及

# print ('I' + ' ' + 'love' + ' ' + 'fishc.com')
# print (' '.join(["I", "love","fishc.com"]))

# print (str1.replace("you","fishc.com"))
# print(str1.split())
str2 = '_'.join("FishC")
# print(str2.split(sep='_'))


# 5.3.2 格式化
# print("{0} love {1}.{2}".format("I","FishC","com"))
# print ("{a} love {b}.{c}".format(a = 'I',b = 'FishC',c= 'com'))
# print ("{0} love {b}.{c}".format('I',b = 'FishC',c= 'com'))
# print ("{a} love {b}.{0}".format('I',b = 'FishC',c= 'com')) # 位置参数必须在关键字参数之前，否则会出错
# print ("{{0}}".format("不打印")) #大括号类似转义字符
# print ("{0}:{1:.2f}".format("圆周率",3.14159))

# print ('%c' % 97)
# print ('%c%c%c%c%c'%(70,105,115,104,67))
# print ('%d 转换未八进制是：%o'%(123,123))
# print ('%f 用科学计数法表示为：%e'%(149500000,149500000))
# print ('%5.1f' % 27.658)
# print('%.2e'%27.658)
# print ('%10d'%5)
# print ('%-10d'%5)
# print ('%010d'%5)
# print ('%#X'%5)


# 5.4 序列
# 创建一个空列表
a = list()
# print (a)

# 将字符串的每个字符迭代存放到列表中
b = list("FishC")
# print(b)

# 将元组中的每个元素迭代存放到列表中
c = list((1, 1, 2, 3, 5, 8, 13))
# print (c)

str1 = "I love fishc.com"
# print (str1)

list1 = [1, 1, 2, 3, 5, 8, 13]
# print (len(list1))

tuple1 = "这", "是", "一", "个", "元组"
# print (len(tuple1))

list1 = [1, 18, 13, 0, -98, 34, 54, 76, 32]
# print (max(list1))

str1 = "I love fishc.com"
# print (max(str1))

# print (max(5,8,1,13,5,29,10,7))

# temp = tuple1[0]
#
# for each in tuple1:
#     if each > temp:
#         temp = each
# return temp

tuple1 = 1, 2, 3, 4, 5
# print (sum(tuple1))
# print (sum(tuple1,10))

list1 = [1, 18, 13, 0, -98, 34, 54, 76, 32]
list2 = list1[:]
list1.sort()
# print (list1)
# print(sorted(list2)) sorted 返回一个排序后的新列表
# print(list2)

list1 = [1,18,13,0,-98,34,54,76,32]
# print (reversed(list1))
#for each in reversed(list1):
#    print (each,end=',')

str1 = "FishC"
# for each in enumerate(str1):
#     print (each)

# zip()方法用于放那会由各个可迭代参数共同组成的元组
list1 = [1,3,5,7,9]
str1 = "FishC"
# for each in zip(list1,str1):
#     print (each)

tuple1 = (2,4,6,8,10)
# for each in zip(list1,str1,tuple1):
#     print (each)


